Number of Operators (NOprtr)

Description:

This measure is used as an input to the Halstead Software Science metrics. It counts the number of operators used in a class.

Example:

01 public class Class1 {
02     public void x(bool v) {
03         int i;
04         if (v) {
05             i = 1;
06         } else {
07             i = 2;
08         }
09         switch(i) {
10             case 1: break;
11             case 2: break;
12             default: break;
13         }
14         try {
15             while(v) {
16                 v = false;
17                 int r = 1;
18                 Exception ex = new Exception("!!!");
19                 i = i * i + r;
20                 break;
21             }
22         } catch (Exception e) {
23             throw e;
24         }
25     }
26 }

Line N1 n1 N2 n2
04 if if v v
05 = = i, 1 i, 1
07 =   i, 2 2
09 switch switch i  
15 loop loop v  
16 =   v, false false
17 =   1  
18 =, new, call new, call Exception, "!!!" Exception, "!!!"
19 =, *, + *, + i, i, i, r r
23 throw throw e e
Total 14 9 17 9

Where